package com.JohnCarloSalter.bestbuy_coupons;

import com.JohnCarloSalter.ReceiptDecorator.ReceiptDecorator;
import com.JohnCarloSalter.Receipt.*;

public class CouponDecorator extends ReceiptDecorator {

	private Receipt r;
	
	public CouponDecorator(ReceiptComponent trailer, Receipt appliedReceipt) {
		super.create(trailer);
		r = appliedReceipt;
	}
	
	//No-trailer constructor
	public CouponDecorator(Receipt appliedReceipt) {
		r = appliedReceipt;
	}
	
	public void print() {
		super.callTrailer();
		System.out.println("\n!!!!READY FOR SAVINGS?!!!!");
		System.out.println("Bring this coupon back for 10% off your next purchase!");
		System.out.println("HURRY BACK! OFFER EXPIRES TOMORROW!");
		System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!\n");

	}
	
	public boolean applies() {
		if(r.getSubtotal() >= 100.00) {
			return true;
		} else {
			return false;
		}
	}

}
